<div class="main">
<?php if (!isset($_SESSION['id'])) { // Show the signup form only if the user isn't logged in. ?>
	<h1>Sign up form</h1>
	<form action="<?php echo $base ?>" method="post">
		<table>
			<tr>
				<td><label for="name">Name:</label></td>
				<td><input id="name" name="name" type="text" value="<?php echo set_value('name') ?>"/></td>
				<?php echo form_error('name', '<td class="validation_error">', '</td>') ?>
			</tr>
			<tr>
				<td><label for="school">School:</label></td>
				<td><input id="school" name="school" type="text" value="<?php echo set_value('school') ?>"/></td>
				<?php echo form_error('school', '<td class="validation_error">', '</td>') ?>
			</tr>
			<tr>
				<td><label for="city">City:</label></td>
				<td><input id="city" name="city" type="text" value="<?php echo set_value('city') ?>"/></td>
				<?php echo form_error('city', '<td class="validation_error">', '</td>') ?>
			</tr>
			<tr>
				<td><label for="state">State:</label></td>
				<td><input id="state" name="state" type="text" value="<?php echo set_value('state') ?>"/></td>
				<?php echo form_error('state', '<td class="validation_error">', '</td>') ?>
			</tr>
			<tr>
				<td><label for="email">Email address:</label></td>
				<td><input id="email" name="email" type="text" value="<?php echo set_value('email') ?>"/></td>
				<?php echo form_error('email', '<td class="validation_error">', '</td>') ?>
			</tr>
				<td><label for="password1">Password:</label></td>
				<td><input id="password1" name="password" type="password" value="<?php echo set_value('password') ?>"/></td>
				<?php echo form_error('password', '<td class="validation_error">', '</td>') ?>
			<tr>
				<td><label for="password2">Confirm password:</label></td>
				<td><input id="password2" name="password_confirm" type="password" value="<?php echo set_value('password_confirm') ?>"/></td>
				<?php echo form_error('password_confirm', '<td class="validation_error">', '</td>') ?>
			</tr>
			<tr>
				<td>I am a:</td>
				<?php echo form_error('role', '<td class="validation_error">', '</td>') ?>
			</tr>
			<?php foreach ($roles as $role): ?>
			<tr>
				<td><input id="<?php echo 'role'.$role['id'] ?>" name="role" type="radio" value="<?php echo $role['id'] ?>" <?php echo set_radio('role', $role['id']); ?>/></td>
				<td><label for="<?php echo 'role'.$role['id'] ?>"><?php echo $role['name'] ?></td>
			</tr>
			<?php endforeach ?>
		</table>
		<input id="signup" type="submit" value="SIGN UP"/>
	</form>
<?php } ?>
</div>
